/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BLO;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author ThanhTai
 */
public class ServletListener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent sce) {
        String realPath = sce.getServletContext().getRealPath("/");

        ProductsBLO productBLO = new ProductsBLO();
        productBLO.getNewProducts(realPath + "xml/newProducts.xml");
        productBLO.getTopSaleProducts(realPath + "xml/topSaleProducts.xml");
        productBLO.getAllProducts(realPath + "xml/allProducts.xml");

        BrandsBLO brandsBLO = new BrandsBLO();
        brandsBLO.getAllBrands(realPath + "xml/brands.xml");

        NewBLO newBLO = new NewBLO();
        newBLO.getAllNews(realPath + "xml/news.xml");
    }

    public void contextDestroyed(ServletContextEvent sce) {
    }
}
